C_1=importdata('reportC_1.txt');
C_2=importdata('reportC_2.txt');
C_3=importdata('reportC_3.txt');
C_4=importdata('reportC_4.txt');
x=linspace(-1,1,10000);
for i=1:10000
   y(i)=1/(1+25*x(i)*x(i)); 
end

n=5;
b_1=ones(n,10000);
for i=2:n
    for j=1:10000
        b_1(i,j)=b_1(i-1,j)*(x(j)-cos( pi  * ( 2.0 * i - 3.0) / (2 * n) ));
    end
end
y_1=C_1'*b_1;


n=10;
b_2=ones(n,10000);
for i=2:n
    for j=1:10000
        b_2(i,j)=b_2(i-1,j)*(x(j)-cos( pi  * ( 2.0 * i - 3.0) / (2 * n) ));
    end
end
y_2=C_2'*b_2;


n=15;
b_3=ones(n,10000);
for i=2:n
    for j=1:10000
        b_3(i,j)=b_3(i-1,j)*(x(j)-cos( pi  * ( 2.0 * i - 3.0) / (2 * n) ));
    end
end
y_3=C_3'*b_3;


n=20;
b_4=ones(n,10000);
for i=2:n
    for j=1:10000
        b_4(i,j)=b_4(i-1,j)*(x(j)-cos( pi  * ( 2.0 * i - 3.0) / (2 * n) ));
    end
end
y_4=C_4'*b_4;

fig=figure(1);hold on;
plot(x,y);plot(x,y_1);plot(x,y_2);plot(x,y_3);plot(x,y_4);
hold off;
frame=getframe(fig);
img=frame2im(frame);
imwrite(img,'C.png');